home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_1
/
easyprocess
/
source
/
launch
/
childentry.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-07
|
1KB
|
66 lines
#include <arpbase.h>
#include <arp_proto.h>
#include "Launch.h"
#include "LaunchPriv.h"
/*
* NAME
* ChildEntry -- used when starting processes.
*
* SYNOPSIS
* ChildEntry ()
*
* FUNCTION
* Call the process' entry point with its data.
*
* DESCRIPTION
* It load the A4 register, find the process pair (parent/child),
* allocate the child's kill signal and then call the child entry
* point with the data given by the parent. On exit, it clears
* the entry point and signal the parent.
*
* INPUT
* None.
*
* OUTPUT
* None.
*
* NOTE
* We currently use the break C signal as the kill signal. This
* let the user kill the process himself (if anything should go
* wrong...).
*
* HISTORY
* 1992/09/06 Pierre Baillargeon Creation
* 1992/09/07 Pierre Baillargeon Correction
* Now, the node removal and memory freeing is done
* in the parent. Otherwise the parent signal bit
* would not always be freed.
*
* SEE ALSO
* StartProcess()
*/
void __saveds ChildEntry (void)
{
struct ProcPair *pp;
struct Process *Proc;
Proc = (struct Process *)FindTask (NULL);
Wait (1L << Proc->pr_MsgPort.mp_SigBit);
Forbid ();
pp = IsChild (Proc);
Permit ();
if (pp)
{
pp->pp_ChildBit = AllocSignal (KILL_PROCESS_FLAG);
pp->pp_ChildEntry (pp->pp_ChildData);
Forbid ();
pp->pp_ChildEntry = NULL;
Signal (pp->pp_Parent, 1L << pp->pp_ParentBit);
}
}